# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=needle
pkgver=579.891b660
pkgrel=3
pkgdesc='The iOS Security Testing Framework.'
groups=('blackarch' 'blackarch-mobile')
arch=('any')
url='https://github.com/mwrlabs/needle'
license=('custom:unknown')
depends=('python2' 'python2-pysqlite' 'python2-paramiko' 'python2-pyopenssl'
         'python2-frida' 'python2-sshtunnel' 'mitmproxy' 'python2-biplist')
makedepends=('git')
source=("git+https://github.com/mwrlabs/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}


package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md CHANGELOG.md
  install -Dm 644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md"

  rm *.md

  cp -a needle/* "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname/
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

